class Onetimeresult():
    # 这里增添需要的元素
    def __init__(self, p_pv=None, p_grid=None, p_escape=None, p_bs=None, bs_status=None, battery=None, B=None,
                 E_carbon=None, ce=None, ee=None,
                 delta_pv=None, delta_connected=None, system_status=True,
                 additional_info=None, x_bs_ue=None, r_ue=None, consume_pv=None,
                 city_e = None, pv_rate=None):
        self.p_pv = p_pv  # shape=[1,const.BS_NUM]
        self.p_grid = p_grid  # shape=[1,const.BS_NUM]
        self.p_escape = p_escape  # shape=[1,const.BS_NUM]
        self.p_bs = p_bs
        self.battery = battery  # shape=[1,const.BS_NUM]
        self.bs_status = bs_status  # shape=[1,const.BS_NUM]
        self.B = B
        self.E_carbon = E_carbon  # shape=[1,const.BS_NUM]
        self.ce = ce  # shape=[const.MAX_STEP,1]
        self.ee = ee
        self.delta_pv = delta_pv
        self.delta_connected = delta_connected
        self.system_status = system_status  # True 正常 False 宏基站过载

        self.additional_info = additional_info  # 额外的备注信息，可以得知具体的情况，比如“用户关联但是基站不休眠优化结果”
        self.x_bs_ue = x_bs_ue
        self.r_ue = r_ue    #
        self.consume_pv = consume_pv    #消纳的光伏能量
        self.city_e = city_e
        self.pv_rate = pv_rate

    # 用于进行备注信息
    def set_info(self, info):
        """
        增添备注信息
        :param info:
        :return:
        """
        self.additional_info = info
        return True

    def __str__(self):
        """
        优化对象表示，可以print语句直接打印对象
        :return:
        """
        ce_scientific_form = f"{self.ce:.2e}"
        info = "===============================================\n"
        info += f"当前打印的是{self.additional_info}:\n"
        info += f"其对应的基站状态是{self.bs_status}\n"
        info += f"其对应的ce是{ce_scientific_form}\n"
        info += f"其对应的最终用户关联策略是{self.x_bs_ue}\n"
        info += f"其对应的用户速率是{self.r_ue}\n"
        info += f"其对应的基站功耗是{self.p_bs}\n"
        info += f"其对应的碳排放量是{self.E_carbon}\n"
        info += f"其对应的用户的数据量是{self.B}\n"
        return info


class Sleepaction():
    def __init__(self, bs_status=None, x_bs_ue=None, t_bs_bs=None, C=None, D=None, system_status=True):
        self.bs_status = bs_status
        self.x_bs_ue = x_bs_ue
        self.system_status = system_status  # True 正常 False 宏基站过载


class Timeresult():  # 拉长时间线的结果
    def __init__(self, p_pv=None, p_grid=None, p_escape=None, p_bs=None, bs_status=None, battery=None, B=None,
                 E_carbon=None, ce=None, ee=None, delta_pv=None, delta_connected=None):
        self.p_pv = p_pv  # shape=[const.MAX_STEP,const.BS_NUM]
        self.p_grid = p_grid  # shape=[const.MAX_STEP,const.BS_NUM]
        self.p_escape = p_escape  # shape=[const.MAX_STEP,const.BS_NUM]
        self.p_bs = p_bs
        self.battery = battery  # shape=[const.MAX_STEP,const.BS_NUM]
        self.bs_status = bs_status  # shape=[const.MAX_STEP,const.BS_NUM]
        self.B = B  # shape=[const.MAX_STEP,1]
        self.E_carbon = E_carbon  # shape=[const.MAX_STEP,const.BS_NUM]
        self.ce = ce  # shape=[const.MAX_STEP,1]
        self.ee = ee
        self.delta_pv = delta_pv  # shape=[const.MAX_STEP,1]
        self.delta_connected = delta_connected  # shape=[const.MAX_STEP,1]


class Monthresult():  # 拉长时间线的结果
    def __init__(self, p_pv=None, p_grid=None, p_escape=None, p_bs=None, B=None, E_carbon=None, ce=None, delta_pv=None,
                 delta_connected=None):
        self.p_pv = p_pv  # shape=[1,12]  所有基站12个月的结果
        self.p_grid = p_grid  # shape=[1,12]
        self.p_escape = p_escape  # shape=[1,12]
        self.p_bs = p_bs
        self.B = B  # shape=[1,12]
        self.E_carbon = E_carbon  # shape=[1,12]
        self.ce = ce  # shape=[1,12] 每月平均碳效
        self.delta_pv = delta_pv  # shape=[1,12] 每月平均
        self.delta_connected = delta_connected  # shape=[1,12] 每月平均


class SolarResult():
    def __init__(self, p_pv=None, p_grid=None, p_escape=None, p_bs=None, B=None, E_carbon=None, ce=None, delta_pv=None,
                 delta_connected=None, delta_sleep=None):
        self.p_pv = p_pv  # shape=[1,sloar_step]  所有基站12个月的结果
        self.p_grid = p_grid  # shape=[1,sloar_step]
        self.p_escape = p_escape  # shape=[1,sloar_step]
        self.p_bs = p_bs
        self.B = B  # shape=[1,sloar_step]
        self.E_carbon = E_carbon  # shape=[1,sloar_step]
        self.ce = ce  # shape=[1,sloar_step]
        self.delta_pv = delta_pv  # shape=[1,sloar_step]
        self.delta_connected = delta_connected  # shape=[1,sloar_step]
        self.delta_sleep = delta_sleep  # 微基站休眠率


class UserResult():
    def __init__(self, p_pv=None, p_grid=None, p_escape=None, p_bs=None, B=None, E_carbon=None, ce=None, delta_pv=None,
                 delta_connected=None, delta_sleep=None):
        self.p_pv = p_pv  # shape=[1,user_step]  所有基站12个月的结果
        self.p_grid = p_grid  # shape=[1,user_step]
        self.p_escape = p_escape  # shape=[1,user_step]
        self.p_bs = p_bs
        self.B = B  # shape=[1,user_step]
        self.E_carbon = E_carbon  # shape=[1,user_step]
        self.ce = ce  # shape=[1,user_step]
        self.delta_pv = delta_pv  # shape=[1,user_step]
        self.delta_connected = delta_connected  # shape=[1,user_step]
        self.delta_sleep = delta_sleep  # 微基站休眠率
